package net.xuhf.es.service.impl;

import net.xuhf.es.dao.CityRepository;
import net.xuhf.es.domain.City;
import net.xuhf.es.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class CityServiceImpl implements CityService {

    @Resource
    private CityRepository cityRepository;

    @Resource
    private ElasticsearchRestTemplate elasticsearchRestTemplate;

    @Override
    public void saveIndex(String index) {
        elasticsearchRestTemplate.createIndex(index);
    }

    @Override
    public void saveOne(City city) {
        cityRepository.save(city);
    }
}
